package com.qdlc.p2p.biz.processor.task.pay;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import com.qdlc.p2p.biz.processor.event.BorrowFullVerifyPayValueEvent;
import com.qdlc.p2p.biz.processor.task.AbstractTaskProcessor;
import com.qdlc.p2p.biz.service.CollectPayService;
import com.qdlc.p2p.common.core.queue.TaskProcessorException;
import com.qdlc.p2p.common.core.queue.ValueEvent;
import com.qdlc.p2p.dal.dto.TppTradeLog;

/**
 * 满标复审代付事件处理（放款）
 *
 * @author Kaiju Zhao
 * @date 2016-03-10
 * @version 1.1.0.0
 */
@Service
public class BorrowFullVerifyPayTaskProcessor extends AbstractTaskProcessor {

	@Resource
	@Qualifier("borrowFullVerifyPayService")
	private CollectPayService borrowFullVerifyPayService;

	@Override
	public boolean supports(ValueEvent event) {
		return event instanceof BorrowFullVerifyPayValueEvent;
	}

	@Override
	protected void process0(ValueEvent event) throws TaskProcessorException {
		BorrowFullVerifyPayValueEvent valueEvent = (BorrowFullVerifyPayValueEvent) event;
		TppTradeLog tppTradeLog = valueEvent.getTppTradeLog();
		borrowFullVerifyPayService.requestOrder(tppTradeLog);
	}
}
